<!DOCTYPE html>
<html ng-app='app'>

<head>
  <meta charset="utf-8">
  <title translate="load.predefined.TITLE">lazy load files without autoupload</title>
  <style>body { text-align: center; }</style>
</head>

<body ng-controller="ctrl">

  <p>
    <a href="#" ng-click="setLang('en_US')">English</a>
    |
    <a href="#" ng-click="setLang('ru_RU')">Русский</a>
  </p>

  <h1 translate>load.predefined.HEADER</h1>
  <h2 translate>load.predefined.SUBHEADER</h2>

<script src="../bower_components/angular/angular.js"></script>
<script src="../bower_components/angular-cookies/angular-cookies.js"></script>
<script src="../dist/angular-translate.js"></script>
<script src="../dist/angular-translate-storage-cookie/angular-translate-storage-cookie.js"></script>
<script src="../dist/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>

<script>
angular.module('app', ['pascalprecht.translate', 'ngCookies'])

.config(['$translateProvider', function($translateProvider){

  // Register a loader for the static files
  // So, the module will search missing translation tables under the specified urls.
  // Those urls are [prefix][langKey][suffix].
  $translateProvider.useStaticFilesLoader({
    prefix: 'l10n/',
    suffix: '.json'
  });

  // Predefine a default language
  $translateProvider.translations('en_US', {
    "load" : {
      "predefined" : {
        "TITLE" : "How to use lazy loading without autoupload?",
        "HEADER" : "You can predefine a default language while still using a lazy loading.",
        "SUBHEADER" : "This way module will not load a default language from server once more."
      }
    }
  });

  // Tell the module what language to use by default
  $translateProvider.preferredLanguage('en_US');

  // Tell the module to store the language in the cookies
  $translateProvider.useCookieStorage();

}])

.controller('ctrl', ['$scope', '$translate', function($scope, $translate) {

  $scope.setLang = function(langKey) {
    // You can change the language during runtime
    $translate.use(langKey);
  };

}]);
</script>

</body>
</html>
